﻿using ApplicationModels.A02.Identities;
using ApplicationModels.A03.Photographs;
using ApplicationModels.A04.Interactions;
using ApplicationModels.A05.Reports;
using ApplicationModels.A06.Socializes;
using ApplicationModels.A07.Chats;
using ApplicationModels.A08.Statistics;
using AutoMapper;
using Commons.Enums;
using EntityModels.E02.Identities;
using EntityModels.E03.Photographs;
using EntityModels.E04.Interactions;
using EntityModels.E05.Reports;
using EntityModels.E06.Socializes;
using EntityModels.E07.Chats;
using EntityModels.E08.Statistics;

namespace ApplicationService.Helpers
{
    public class MappeerProfile : Profile
    {
        public MappeerProfile()
        {
            CreateMap<PhotographType, PhotographTypeAM>();
            CreateMap<PhotographTypeAM, PhotographType>();
            CreateMap<Photograph, PhotographAM>();
            CreateMap<PhotographAM, Photograph>();
            CreateMap<AppUser, AppUserAM>().ForMember(x => x.SexName, opt => opt.MapFrom(src => src.Sex.ToString()));
            CreateMap<AppUserAM, AppUser>().ForMember(x=>x.Sex,opt=>opt.MapFrom(r=>r.SexName));
            CreateMap<PhotographStatistics, PhotographStatisticsAM>();
            CreateMap<PhotographStatisticsAM, PhotographStatistics>();
            CreateMap<Comment, CommentAM>();
            CreateMap<CommentAM, Comment>();
            CreateMap<CommentReport, CommentReportAM>()
                .ForMember(x => x.AppUserName, opt => opt.MapFrom(src => src.Comment.AppUser.NickName))
                .ForMember(x => x.ReporterName, opt => opt.MapFrom(src => src.Reporter.NickName))
                 .ForMember(x => x.StatusName, opt => opt.MapFrom(src => src.Status.ToString()));
            CreateMap<CommentReportAM, CommentReport>();
            CreateMap<ReportType, ReportTypeAM>();
            CreateMap<ReportTypeAM, ReportType>();
            CreateMap<Report, ReportAM>()
                .ForMember(x => x.AppUserName, opt => opt.MapFrom(rec=>rec.Photograph.AppUser.NickName))
                 .ForMember(x => x.ReporterName, opt => opt.MapFrom(src => src.Reporter.NickName))
                .ForMember(x => x.StatusName, opt => opt.MapFrom(src => src.Status.ToString()));
            CreateMap<ReportAM, Report>();
            CreateMap<Follow, FollowAM>();
            CreateMap<FollowAM, Follow>();
            CreateMap<Star, StarAM>();
            CreateMap<StarAM, Star>();
            CreateMap<StarItem, StarItemAM>();
            CreateMap<StarItemAM, StarItem>();
            CreateMap<Like, LikeAM>();
            CreateMap<LikeAM, Like>();
            CreateMap<Conversation, ConversationAM>();
            CreateMap<ConversationAM, Conversation>();
            CreateMap<Message, MessageAM>();
            CreateMap<MessageAM, Message>();

        }
    }
}
